package com.cie2.janji.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;

@Entity
@Table(name="article")
public class Article {

	private Long id;
	
	private String title;
	
	private String abstraction;
		
	private String content;	

	private User author;
	
	private String image;
		
	private boolean publish;
	
	private Date createdDate;
	
	private Date updatedDate;
	
	private Date publishDate;

	private Integer year;
	
	private Integer month;
	
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NonVisual			
	public Long getId() {
		return id;
	}
	

	public String getTitle() {
		return title;
	}
	
    @Column(columnDefinition="TEXT")
	public String getAbstraction() {
		return abstraction;
	}

    @Column(columnDefinition="TEXT")
	public String getContent() {
		return content;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public Integer getMonth() {
		return month;
	}

	public Integer getYear() {
		return year;
	}	
	public String getImage() {
		return image;
	}

	public boolean isPublish() {
		return publish;
	}

	public Date getPublishDate() {
		return publishDate;
	}


	public Date getUpdatedDate() {
		return updatedDate;
	}
	
    @ManyToOne(targetEntity=User.class)
    @JoinColumn(name="AUTHOR_ID")
	public User getAuthor() {
		return author;
	}

	public void setAbstraction(String abstraction) {
		this.abstraction = abstraction;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public void setPublish(boolean publish) {
		this.publish = publish;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setUpdatedDate(Date updatedDate) {
		this.updatedDate = updatedDate;
	}

	public void setAuthor(User author) {
		this.author = author;
	}


	public void setMonth(Integer month) {
		this.month = month;
	}


	public void setYear(Integer year) {
		this.year = year;
	}
	
}
